Skip to content

feat: add apisixupstream controller#169

Merged
dspo merged 12 commits into
release-v2-devfrom
feat/apisixupstream-controller
Jun 19, 2025
Merged

feat: add apisixupstream controller#169
dspo merged 12 commits into
release-v2-devfrom
feat/apisixupstream-controller

Conversation

@dspo
Copy link
Copy Markdown
Contributor

@dspo dspo commented Jun 18, 2025

Type of change:

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches
  • Documentation
  • Refactor
  • Chore
  • CI/CD or Tests

What this PR does / why we need it:

add ApisixUpstream controller

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

dspo added 11 commits June 17, 2025 16:10
…eam handling

- Remove legacy ApisixUpstream controller.
- Update related CRDs and deepcopy functions.
- Add new translator logic for ApisixUpstream.
- Introduce indexing and mapping logic for ApisixUpstream in ApisixRoute reconciliation.
- Implement `translateApisixUpstream` to support ApisixUpstream translation.
- Add handling for externalNodes with types Domain and Service.
- Update ApisixRoute translator to integrate ApisixUpstream references.
- Introduce `SchemeToPort` and `MatchHostDef` utility functions for validation and defaults.
- Enable e2e tests for ApisixRoute referencing ApisixUpstream.
- Moved HTTP rule handling to `processApisixRouteHTTPRule` for improved modularity.
- Updated ApisixRoute controller to integrate the new function.
- Enhanced indexing for ApisixRoute to include ApisixUpstream secrets and services.
- Refactored e2e tests to validate updated ApisixRoute and ApisixUpstream logic.
…lators

- Removed redundant `apisixUpstreams` and `adcUpstreams` variables in ApisixRoute translator logic for clarity.
- Streamlined upstream handling and variable naming in traffic-split logic.
- Updated TODO comments to reflect upcoming `.Checks`, `.TLS`, and `.Discovery*` implementations.
…ests

- Refactor `NewDefaultUpstream` initialization for streamlined field ordering.
- Update e2e framework's `GetServiceEndpoints` to accept `types.NamespacedName`.
- Incorporate upstream weights into traffic-split logic, including default handling and labels.
- Add comprehensive e2e tests for mixed backend and upstream scenarios.
…upstream

# Conflicts:
#	internal/controller/apisixroute_controller.go
#	internal/controller/indexer/indexer.go
#	internal/provider/adc/translator/apisixroute.go
- Introduce a new ApisixUpstream controller for resource management.
- Update CRDs with `subresources.status` and define ApisixUpstreamStatus schema.
- Refactor ApisixPluginConfig reconciliation by removing unused logic and improving error handling.
- Enhance e2e tests to validate ApisixRoute referencing ApisixUpstream.
- Add copy logic for ApisixUpstream status in generated deepcopy functionality.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 18, 2025

conformance test report

apiVersion: gateway.networking.k8s.io/v1
date: "2025-06-19T01:26:39Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
  contact: null
  organization: APISIX
  project: apisix-ingress-controller
  url: https://github.com/apache/apisix-ingress-controller.git
  version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
    failedTests:
    - HTTPRouteCrossNamespace
    result: failure
    skippedTests:
    - HTTPRouteHTTPSListener
    statistics:
      Failed: 1
      Passed: 31
      Skipped: 1
  name: GATEWAY-HTTP
  summary: Core tests failed with 1 test failures.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 18, 2025

conformance test report

apiVersion: gateway.networking.k8s.io/v1
date: "2025-06-19T01:29:23Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
  contact: null
  organization: APISIX
  project: apisix-ingress-controller
  url: https://github.com/apache/apisix-ingress-controller.git
  version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
    result: partial
    skippedTests:
    - HTTPRouteHTTPSListener
    statistics:
      Failed: 0
      Passed: 32
      Skipped: 1
  name: GATEWAY-HTTP
  summary: Core tests partially succeeded with 1 test skips.

…upstream-controller

# Conflicts:
#	internal/controller/apisixupstream_controller.go
#	test/e2e/apisix/route.go
@dspo dspo requested a review from Copilot June 19, 2025 01:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new ApisixUpstream controller to enhance the management of upstream resources. Key changes include:

  • Adding the ApisixUpstream controller implementation and its integration in the manager.
  • Updating end-to-end tests to use the new applier.MustApplyAPIv2 API.
  • Enhancing CRD definitions to support status subresources.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/e2e/apisix/route.go Updated test cases to utilize applier.MustApplyAPIv2 for resource creation.
internal/manager/controllers.go Registered the new ApisixUpstreamReconciler for controller setup.
internal/controller/apisixupstream_controller.go Introduced the ApisixUpstream controller implementation.
internal/controller/apisixpluginconfig_controller.go Simplified the processIngressClassParameters function signature.
docs/crd/api.md Added new documentation sections for CRD updates.
config/crd/bases/apisix.apache.org_apisixupstreams.yaml Extended the CRD definition with new status properties and subresources.
api/v2/zz_generated.deepcopy.go Updated deep copy functionality to include the new status field.
api/v2/apisixupstream_types.go Added the status field and corresponding kubebuilder markers.
Comments suppressed due to low confidence (1)

config/crd/bases/apisix.apache.org_apisixupstreams.yaml:537

  • [nitpick] For consistency and clarity, consider quoting 'Unknown' in the enum so that it matches the other quoted enum values.
                      - Unknown

NamespacedName: utils.NamespacedName(au),
Resource: &apiv2.ApisixUpstream{},
Mutator: status.MutatorFunc(func(obj client.Object) client.Object {
cp := obj.(*apiv2.ApisixUpstream).DeepCopy()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be asserted first whether it is of the type '*apiv2.ApisixUpstream'

Copy link
Copy Markdown
Contributor

@ronething ronething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dspo dspo merged commit 2755d41 into release-v2-dev Jun 19, 2025
13 of 15 checks passed
@dspo dspo deleted the feat/apisixupstream-controller branch June 23, 2025 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants